import random
level=input('请选择难度1.(1-10) 2.(1-100):')
i=1
count=0
if level=='1':
    while i<=10:
        a=random.randint(1,10)
        b=random.randint(1,10)
        c = random.randint(1, 5)
        if c==1:
            answer=int(input(f'{a} + {b} ='))
            if answer==a+b:
                count+=1
        elif c==2:
            answer=int(input(f'{a} - {b} ='))
            if answer==a-b:
                count+=1
        elif c==3:
            answer=int(input(f'{a} * {b} ='))
            if answer==a*b:
                count+=1
        elif c==4:
            answer=int(input(f'{a} / {b} ='))
            if answer==a/b:
                count+=1
        i+=1
elif level=='2':
    while i<=10:
        a=random.randint(1,100)
        b=random.randint(1,100)
        c=random.randint(1, 5)
        if c==1:
            answer=int(input(f'{a} + {b} ='))
            if answer==a+b:
                count+=1
        elif c==2:
            answer=int(input(f'{a} - {b} ='))
            if answer==a-b:
                count+=1
        elif c==3:
            answer=int(input(f'{a} * {b} ='))
            if answer==a*b:
                count+=1
        elif c==4:
            answer=int(input(f'{a} / {b} ='))
            if answer==a/b:
                count+=1
        i+=1
print(f'你答对了{count}题')

